#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <utility>
using namespace std;

#define mm(a, n) memset(a, n, sizeof a)
#define mk(a, b) make_pair(a, b)

const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef pair<LL, LL> PLL;
typedef pair<int, LL> PIL;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

LL a1, a2, b1, b2;
LL a3, b3;

LL gcd(LL a, LL b) {
    return b > 0 ? gcd(b, a % b) : a;
}

LL lcm(LL a, LL b) {
    return a * (b / gcd(a, b));
}

// 表示是否是整数
bool r1, r2;
bool r3;

char op[4] = {'+', '-', '*', '/'};

bool calc(char op) {
    r3 = false, a3 = 0, b3 = 0;
    switch (op)
    {
    case '+':{
        LL l = lcm(b1, b2);
        LL a_1 = (l / b1) * a1, a_2 = (l / b2) * a2;
        b3 = l, a3 = a_1 + a_2;
        l = gcd(abs(a3), b3);
        a3 /= l, b3 /= l;
        if (b3 == 1) r3 = true;
    }
        break;
    case '-': {
        LL l = lcm(b1, b2);
        LL a_1 = (l / b1) * a1, a_2 = (l / b2) * a2;
        b3 = l, a3 = a_1 - a_2;
        l = gcd(abs(a3), b3);
        a3 /= l, b3 /= l;
        if (b3 == 1) r3 = true;
    }
        break;
    case '*': {
        b3 = b2 * b1, a3 = a1 * a2;
        LL l = gcd(abs(a3), b3);
        a3 /= l, b3 /= l;
        if (b3 == 1) r3 = true;
    }
        break;
    case '/': {
        // return inf
        if (a2 == 0) return false;
        
        LL b_1 = b1, b_2 = b2;
        LL a_1 = a1, a_2 = a2;
        if (a_2 < 0) a_2 = -a_2, b_2 = -b_2;
        b3 = b_1 * a_2, a3 = a_1 * b_2;
        LL l = gcd(abs(a3), b3);
        a3 /= l, b3 /= l;
        if (b3 == 1) r3 = true;
    }
        break;
    default:
        break;
    }
    return true;
}

void print(bool r1, LL a1, LL b1) {
    if (r1) {
        // integer
        if (a1 < 0) printf("(%lld)", a1);
        else printf("%lld", a1);
    } else {
        if (a1 < 0) {
            if (abs(a1) > abs(b1)) {
                printf("(%lld %lld/%lld)", a1 / b1, abs(a1) - (abs(a1) / b1) * b1, b1);
            } else {
                printf("(%lld/%lld)", a1, b1);
            }
        }
        else {
            if (a1 > b1) {
                printf("%lld %lld/%lld", a1 / b1, a1 - (a1 / b1) * b1, b1);
            } else {
                printf("%lld/%lld", a1, b1);
            }
        }
    }
}

inline void solution() {
    scanf("%lld/%lld %lld/%lld", &a1, &b1, &a2, &b2);
    // 化简
    LL l = gcd(abs(a1), b1);
    a1 /= l, b1 /= l;
    l = gcd(abs(a2), b2);
    a2 /= l, b2 /= l;

    if (b1 == 1) r1 = true;
    if (b2 == 1) r2 = true;

    for (int i = 0; i < 4; i ++ ) {
        // 
        print(r1, a1, b1);
        
        printf(" %c ", op[i]);

        print(r2, a2, b2);
        
        printf(" = ");
        
        if (!calc(op[i])) {
            printf("Inf\n");
            continue;
        }

        print(r3, a3, b3);

        printf("\n");
    }
}

int main() {
    freopen("input.txt", "r", stdin);
    quickread();
    solution();
    return 0;
}